<%-- 
    Document   : profile
    Created on : 24 déc. 2013, 10:56:07
    Author     : root
--%>

<%@page import="java.util.HashMap"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@page import="java.util.Map"%>
<% String pwdError="";
String newPwdError="";
String confNewPwdError="";
String fname="";
String lname="";
String email="";
   String msgFile = "";
    Map<String,String> waitingFile=(HashMap<String,String>) request.getAttribute("waitingFile");
    if(waitingFile.size()>0){
        msgFile = msgFile + "("+waitingFile.size()+")";
        
    }
Map<String,String> e=(Map<String,String>) request.getAttribute("erreur"); 
Map<String,String> c=(Map<String,String>) request.getAttribute("compte"); 
if(e.containsKey("idPwd")){
pwdError=e.get("idPwd");
}
if(e.containsKey("idNewPwd")){
newPwdError=e.get("idNewPwd");
}
if(e.containsKey("idConfNewPwd")){
confNewPwdError=e.get("idConfNewPwd");
}
if(c.containsKey("fname")){
fname=c.get("fname");
}
if(c.containsKey("lname")){
lname=c.get("lname");
}
if(c.containsKey("email") && c.get("email") != null){
email=c.get("email");
}
HttpSession thisSession = (HttpSession) request.getAttribute("thisSession");
    String demande="";
   ArrayList<String> demandeContact = (ArrayList<String>) thisSession.getAttribute("demandeContact");
   if(demandeContact.size()!=0){
       boolean accept = true;
       int notif = demandeContact.size();
       if(notif!=0){
           demande = " (" + notif+")";
       }
   }
   ArrayList<String> newMessage = (ArrayList<String>) thisSession.getAttribute("newMessage");
String newMsg = "";
if(newMessage.size()!=0){
    newMsg= newMsg+" ("+newMessage.size()+")";
}
%>
<!DOCTYPE html>
<html>
	<head>
		<link rel="stylesheet" type="text/css" href="css/profile.css"/>
		<title>MISS Profile Page</title>
	</head>
	<body>
            <header>
            <a href="RedirectConnected"><img src="Pictures/logo.png" class="logo" style="float: outside;"></a>
            <div class="zone">
                <div class="zone-right"></div>
                <div class="zone-left"></div>
                <div class="zone-bg">
                    <ul>
                        <li><a href="RedirectConnected"><span>Home <%= newMsg%></span></a></li>
                        <li><a href="NewContact.html"><span>Contact <%= demande%></span></a></li>
                        <li class="current"><a href="profile.html"><span>Profile</span></a></li>
                        <li><a href="File.html"><span>File <%= msgFile%></span></a></li>
                        <li><a href="Administrator.html"><span>Administration</span></a></li>
                        <li><a href="logout.html"><span>Logout</span></a></li>
                    </ul>
                </div>
            </div>
        </header>
		<div class="profile">
			<h3>My Profile</h3>
				<img src="Pictures/index.jpeg" class="imgprofile"><br>
				<%= fname%> <%= lname%><br>			
				<a href="mailto:example@example.com"><%= email%></a>
		</div>
		<div class="edit">
			<h3><img src="Pictures/edit.png" class="imgedit"> Edit</h3>
                        
				<div class="change">
					<h5>Change my password</h5>
					<form method="post" action="EditProfileServlet">
						<div class="input_line">Old password :<input type="password" name="oldpwd"></div><em><%=pwdError %></em><br>
						<div class="input_line">New password :<input type="password" name="newpwd"></div><em><%=newPwdError %></em><br>
						<div class="input_line">Confirm new password :<input type="password" name="newconf"></div><em><%=confNewPwdError %></em><br>
						<input type="submit" value="Change">
					</form>
				</div>
		</div>
	</body>
</html>
